package dao

import (
	"blog_server/internal/model/entity"
)

func (d Dao) CreateTagArticle(tagId uint, articleId uint) error {
	articleTag := entity.TagArticle{
		TagId:     tagId,
		ArticleId: articleId,
	}
	return articleTag.CreateTagArticle(d.engine)
}

func (d Dao) GetTagNameListByArticleID(id uint) ([]string, error) {
	tagArticle := entity.TagArticle{ArticleId: id}
	return tagArticle.GetTagNamesByArticleID(d.engine)
}

func (d Dao) GetTagArticleByArticleId(id uint) ([]entity.TagArticle, error) {
	var ta entity.TagArticle
	ta.ArticleId = id
	return ta.GetByArticleId(d.engine)
}
